<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Forgot Password</title>
<script language="javascript" type="text/javascript">
function loginValidation()
{
var lname = document.forgetform.lname;
var dob = document.forgetform.dob;
var mail = document.forgetform.email;

if(onlyAlphabets(lname)){
if(validDob(dob)){
if(validEmail(mail)){
	document.forms[0].submit();
	return true;
}
}
}
return false;
}

function onlyAlphabets(Name)  
{   
var words = /^[A-Za-z]+$/;  
if(Name.value.match(words))  
{  
return true;  
}  
else  
{  
alert('Name is required and must be Alphabets');  
return false;  
}
}

function validDob(dobirth)
{
var dateFormat = /^(?:(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])(19|20)[0-9]{2})$/;
if(dobirth.value.match(dateFormat))
{
return true;	
}else{
alert('Date of Birth is Invalid \n Enter Date in MMDDYYYY Format');
return false;
}
}

function validEmail(mailID)
{
var idFormat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;	
if(mailID.value.match(idFormat))  
{  
return true;  
}  
else  
{  
alert('Email ID is Invalid');  
return false;  
}
}

</script>
</head>
<body>
<table width=100% bordercolor="#C6D4E1" bgcolor="#C6D4E1">
<tr><th scope="col"><div align="center"><h1 align="center"><font face="Times New Roman">Tros - Online Banking System </font></h1></div></th></tr>
</table>
&nbsp;
<fieldset>
<legend><b>Credentials </b></legend>
<h3 align=center> Forgot Credentials</h3>
<p align=center>Please provide the informations below as provided while Account Creation </p>
<form name="forgetform" action="resetUser.jsp" onSubmit="return loginValidation();" method="post">
<table width=50% align=center cellpadding=5 cellspacing=0 bgcolor="#D5FFD5">
<tr><td>&nbsp;</td><tr>
<tr>
<td height="25"><div align="right">Last Name</div></td>
<td><input type="text" name="lname" value="" /></td>
</tr>
<tr>
<td height="25"><div align="right">Date of Birth</div></td>
<td><input type="text" name="dob" value="" maxlength="8"/></td>
</tr>
<tr>
<td height="25"><div align="right">Email</div></td>
<td><input type="text" name="email" value="" /></td>
</tr>
<tr>
<td colspan=2 align=center bgcolor="#D5FFD5"><button type="submit"><u>S</u>end Request</button>&nbsp;<button type="reset"><u>R</u>eset</button></td> 
</tr>
<tr><td>&nbsp;</td></tr>
</table>
</form>
</fieldset>
</body>
</html>